//文章分类路由模块
//导入express模块
const express=require("express")

//导入表单验证
const expressJoi=require("@escook/express-joi")
//导入新增文章分类,删除文章分类,依据id获取分类,依据id修改分类的验证规则
const {add_cates_schmea,delete_cate_schema,getByid_cate_schema,update_cate_schema}=require("../schemea/cates")

//导入分类处理模块
const cates_handler=require("../router_handler/cates_handler")

//创建路由
const router=express.Router()

//挂载获取分类列表的接口
router.get("/cates",cates_handler.getCatesList)

//挂载增加文章分类路由的接口
router.post("/addcates",expressJoi(add_cates_schmea),cates_handler.addCates)

//挂载删除文章分类路由模块的接口
router.get("/deleteCates/:id",expressJoi(delete_cate_schema),cates_handler.deleteCates)

//挂载依据id查询文章分类
router.get("/cate/:id",expressJoi(getByid_cate_schema),cates_handler.getCateByid)

//挂载依据id更新文章分类
router.post("/updatecate",expressJoi(update_cate_schema),cates_handler.updateCateById)


//导出路由
module.exports=router